package com.wtcrazy.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wtcrazy.entity.Article;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ArticleMapper extends BaseMapper<Article> {
    @Select("select * from article where title like concat('%', #{title} ,'%') order by time desc limit #{pageNum},#{pageSize}")
    List<Article> selectPage(Integer pageNum, Integer pageSize, String title);

    @Select("select count(*) from article where title like concat('%', #{title} ,'%')")
    Integer selectTotal(String title);

    void deleteArticle(@Param("id") String id);
}
